<?php
    error_reporting(E_ALL || ~E_DEPRECATED || ~E_STRICT || ~E_NOTICE || ~E_WARNING || ~E_CORE_WARNING);
    $fname=$_GET["key"];
	if (!file_exists("upload/". $fname))
    {
        $echostr =  $fname . " 不存在. ";
		file_put_contents("test.log", "$echostr\n", FILE_APPEND);
//	    echo "<script language=\"JavaScript\">alert('$echostr');</script><br/>";
//		echo "<script language=\"JavaScript\">self.setTimeout(window.location.href='/door/serversetting.php',5000);</script><br/>";	
		return;
    }
    $filepath = "upload/". $fname;
    header('Content-Type:application/octet-stream'); //指定下载文件类型
    header('Content-Disposition: attachment; filename="'.$fname.'"'); //指定下载文件的描述
    header('Content-Length:'.filesize($filepath)); //指定下载文件的大小
//将文件内容读取出来并直接输出，以便下载
    readfile($filepath);
    file_put_contents("test.log", "dwsupdate.\n", FILE_APPEND);
    exit(0);
?>